package com.example.listview;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

public class ListviewActivity extends Activity {

    private ListView lv;
    private TextView tv;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_list_view);



        List<String> data = new ArrayList<String>();
        for (int i = 0;i<=20;++i)
            data.add("test data info" + Integer.toString(i));


        lv = (ListView)findViewById(R.id.lvBook);
        tv = (TextView)findViewById(R.id.txtResult);

        ArrayAdapter<String> adapter = new
                ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1,data);
        lv.setAdapter(adapter);

    }
}